package com.free.mini.study.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 模块
 * @author dongsufeng
 * @version 4.0
 * @date 2023/8/1 15:38
 */
@Getter
public enum StudyModuleEnum {
    /**
     * 基础
     */
    JAVA_BASIC("1001","JAVA基础","基础知识练习",""),
    JAVA_THREAD("1002","线程","什么是线程，什么是多线程，怎么实现，多线程安全如何处理？",""),
    SPRING_CLOUD("1003","Spring Cloud","怎么用工具实现微服务","")
    ;


    private final String code;
    private final String name;
    private final String desc;
    private final String coverPicture;

    StudyModuleEnum(String code,String name,String desc,String coverPicture){
        this.code = code;
        this.desc = desc;
        this.name = name;
        this.coverPicture = coverPicture;
    }

    private static final Map<String, StudyModuleEnum> MAP = Arrays.stream(StudyModuleEnum.values())
            .collect(Collectors.toMap(StudyModuleEnum::getCode, e -> e));

    public static StudyModuleEnum getByCode(String code){
        return MAP.get(code);
    }
}
